//
//  LoLViewController.m
//  Newproject3
//
//  Created by rimi on 16/9/22.
//  Copyright © 2016年 Liang. All rights reserved.
//

#import "LoLViewController.h"
#import "LoLTableViewCell.h"
#import "IntrouduceViewController.h"
static NSString *const CellID = @"LoLTableViewCell";
@interface LoLViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong) UITableView *lolTableView;
@end

@implementation LoLViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.lolTableView];
    
    
    
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LoLTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"plistdemo" ofType:@"plist"];
    self.arrayData = [[NSMutableArray alloc] initWithContentsOfFile:plistPath];
   
    cell.firstImage.image =  [UIImage imageNamed:self.arrayData[indexPath.row][@"image"]];
    cell.firstLable.text = self.arrayData[indexPath.row][@"lable1"];
    cell.lastLable.text = self.arrayData[indexPath.row][@"lable2"];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    IntrouduceViewController *vc = [[IntrouduceViewController alloc] init];
    ((IntrouduceViewController *)vc).dic = self.arrayData[indexPath.row];
    [self.navigationController pushViewController:vc animated:YES];
}
- (UITableView *)lolTableView{
    if (!_lolTableView) {
        _lolTableView = [[UITableView alloc] initWithFrame:self.view.frame];
        _lolTableView.rowHeight = 100;
        _lolTableView.delegate = self;
        _lolTableView.dataSource = self;
        [_lolTableView registerNib:[UINib nibWithNibName:@"LoLTableViewCell" bundle:nil] forCellReuseIdentifier:CellID];
    }
    return _lolTableView;
}

@end
